<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="/includes.jsp"%>

<div class="layout">
    <table class="styled" cellspacing="0">
        <tr>
            <th class="styled">Node</th>
            <th class="styled">Delete?</th>
        </tr>
        <logic:iterate name="linkDisplayDTOs" id="link">
            <tr>
                <td class="styled"><beans:write name="link" property="node.pathName"/></td>
                <html:form action="link.do?method=linkDeleteCheck" method="post">
                    <html:hidden name="link" property="nodeLinkId"/>
                    <td class="styled" style="text-align: center;">
                        <logic:equal name="link" property="deletable" value="true">
                            <html:submit property="btnDelete" value="Delete"/>
                        </logic:equal>
                        <logic:notEqual name="link" property="deletable" value="true">
                            No permission
                        </logic:notEqual>
                    </td>
                </html:form>
            </tr>
        </logic:iterate>
    </table>

    <logic:present name="dependencyLinkDTOs">
        <br/><br/>
        <table class="styled" cellspacing="0">
            <tr>
                <th class="styled">Dependencies</th>
                <th class="styled">Delete?</th>
            </tr>
            <logic:iterate name="dependencyLinkDTOs" id="dependency">
                <tr>
                    <td class="styled"><beans:write name="dependency" property="nodePathName"/></td>
                    <html:form action="dependencylink.do?method=dependencyDeleteCheck" method="post">
                        <html:hidden name="dependency" property="dependencyId"/>
                        <html:hidden name="dependency" property="dependantId"/>
                        <td class="styled" style="text-align: center;">
                            <logic:equal name="dependency" property="deletable" value="true">
                                <html:submit property="btnDelete" value="Delete"/>
                            </logic:equal>
                            <logic:notEqual name="dependency" property="deletable" value="true">
                                No permission
                            </logic:notEqual>
                        </td>
                    </html:form>
                </tr>
            </logic:iterate>
        </table>

        <br/><br/>
        <table class="styled" cellspacing="0">
            <tr>
                <th class="styled">Dependants</th>
                <th class="styled">Delete?</th>
            </tr>
            <logic:iterate name="dependantLinkDTOs" id="dependant">
                <tr>
                    <td class="styled"><beans:write name="dependant" property="nodePathName"/></td>
                    <html:form action="dependencylink.do?method=dependencyDeleteCheck" method="post">
                        <html:hidden name="dependant" property="dependencyId"/>
                        <html:hidden name="dependant" property="dependantId"/>
                        <td class="styled" style="text-align: center;">
                            <logic:equal name="dependant" property="deletable" value="true">
                                <html:submit property="btnDelete" value="Delete"/>
                            </logic:equal>
                            <logic:notEqual name="dependant" property="deletable" value="true">
                                No permission
                            </logic:notEqual>
                        </td>
                    </html:form>
                </tr>
            </logic:iterate>
        </table>
    </logic:present>
</div>